<%@page import="bll.EnumName"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="java.util.*,util.*,dal.*,model.*, bll.*"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Login</title>
<link rel="stylesheet" href="css/common.css" />
<link rel="stylesheet" href="css/inputForm.css" />
<link rel="stylesheet" href="css/listForm.css" />
<link rel="stylesheet" href="css/jquery-ui-1.8.14.custom.css" type="text/css" />
<link rel="stylesheet" href="css/hyjack.css" type="text/css" />
<link rel="stylesheet" href="css/datepicker.css" type="text/css" />
<link rel="stylesheet" href="css/themes/ui-lightness/jquery.ui.all.css" />
<link rel="stylesheet" href="css/jquery-ui-timepicker.css" type="text/css" />
<link rel="stylesheet" href="css/jquery-datepicker.css" />
<link rel="stylesheet" href="css/jquery-dialog.css" />

<script language="javascript" type="text/javascript" src="js/datepicker.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.hyjack.select.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.ui.core.min.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.ui.widget.min.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.ui.timepicker.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.ui.datepicker.js"></script>
<script language="javascript" type="text/javascript" src="js/datepicker.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.hyjack.js"></script>
<script language="javascript" type="text/javascript" src="js/ajaxQuickInsert.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.numeric.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.ui.tools.min.js"></script>
<script language="javascript" type="text/javascript" src="js/common.js"></script>

<%
	String logout = null;
	try{
		logout = request.getParameter("logout");
	}catch(Exception e)
	{
		System.out.println("get parameter error");
	}
	if(logout != null && logout.equals("true"))
	{
		if(session.getAttribute("username") != null)
			session.removeAttribute("username");
		if(session.getAttribute("password") != null)
			session.removeAttribute("password");
		

		// 2011-11-17 HUY LE new login way
		AuthenticationUtil.doLogout(request);
	}
%>

<script language="javascript" type="text/javascript">
$(document).ready(pageLoaded);

function pageLoaded()
{
	turnOnNumbericInput();
	initTooltip();	
} 

var requiredInputs = [['username','username_required'],['password','password_required']];



function checkInputs() {
	var valid = true;

	if (checkRequiredInputs(requiredInputs) == false) {
		valid = false;
	}
	// SPECIFIC VALIDATE CODE HERE		

	return valid;
}

	
</script>
</head>
<body>
	<div class="divContainer">
				<form name="form" action="account?mode=login" method="post" onSubmit="return checkInputs()">
					<table class="tblInput">
						<tr>
							<td class="inputHeader">LOGIN</td>
						</tr>
						<tr>
					<td style="padding-left: 500px; padding-right: 400px;">
						<table cellspacing="0px">
						
						<tr class="trField">
							<td class="tdFieldName">User Name</td>
						</tr>
						<tr class="trField">
							<td class="tdFieldInput">
								<input class="inputText" type="text" id="username" name="username" maxlength="25" value="admin" title="User name of account. Note: Required." onblur="validateRequiredInput('user_name');"/>
							</td>
							<td class="tdErrMsg">
								<span id="username_required" class="errMsg" style="display: none;" title="User name is required">(!)</span> 
								
							</td>
						</tr>
						
						<tr class="trField">
							<td class="tdFieldName">Password</td>
						</tr>
						<tr class="trField">
							<td class="tdFieldInput">
								<input class="inputText" type="password" id="password" name="password" maxlength="25" value="admin" title="Password of account. Note: Required." onblur="validateRequiredInput('password');"/>
							</td>
							<td class="tdErrMsg">
								<span id="password_required" class="errMsg" style="display: none;" title="Password is required">(!)</span> 
								
							</td>
						</tr>
						<tr class="trField">
							<td class="tdFieldInput">
								<span class="textGuide"><a href="#">Fogot your password?</a></span>
							</td>
						</tr>
						<tr class="trField">
							<td class="tdFieldInput">
								<table class="tblBool">
									<tr class="trBoolSet">
										<td class="tdBoolSet">
											<input type="checkbox" name ="bRemember">Remember me?
										</td>
									</tr>
								</table>
							</td>
						</tr>
						
						<tr class="trInputBottom">

							<td class="tdSubmit" style="text-align: center;"><input class="btnSubmit" type="submit" value="Login" title="Click to login with above account."/></td>

						</tr>
						
						<tr class="trField">
							<td>Login with username: "admin", password: "admin" to go to manager page</td>
						</tr>
						<tr class="trField">
							<td>Login with username: "user", password: "user" to go to normal user page</td>
						</tr>						
					</table>
				</td>
			</tr>
		</table>
	</form>
	
	</div>
</body>
</html>